为产品提供事件的增删改查功能
功能描述:指定产品,为该产品添加事件草稿。
POST /api/v1/affair/thing/draft/add
Body:
Name | Type | Description | Required |
---|---|---|---|
name | string | 事件名称 | Yes |
productId | int | 产品ID | Yes |
class | int | 属性种类 1: 属性, 2: 事件 | Yes |
identifier | string | 属性名 | Yes |
kind | int | 属性分类 1: 标准, 2: 自定义 | No |
required | boolean | 属性是可选还是必选 true: 必选, false: 可选 | No |
type | int | 事件类型,信息:1,告警:2, 故障:3 | Yes |
value | struct[] | 对部分数据类型的补充说明 | No |
valueString | int | 属性值的说明或限制,入库用 | No |
modified | long | 修改时间 | No |
description | String | 描述 | No |
created | long | 创建时间 | No |
value的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
name | string | 界面显示属性名 | Yes |
identifier | string | 属性名 | Yes |
type | int | 数据类型,具体值参考公共能力type类型码表 | Yes |
maximum | long | 最大值 | No |
minimum | long | 最小值 | No |
special | struct[] | 对部分数据类型的补充说明 | No(string/bytes/float32/float64/boolean/enum时必传) |
unit | string | 单位 | No |
special的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
length | int | string/bytes类型的字符串长度,1~2048 | No(string/bytes类型时必传) |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) | No(boolean或enum类型时必传) |
enumArray的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) | Yes |
describe | string | 值对应的说明 | Yes |
Body example:
{
"class": 2,
"created": 0,
"description": "",
"id": 0,
"identifier": "test",
"kind": 0,
"modified": 0,
"name": "test",
"productId": 100075,
"required": true,
"type": 1,
"value": [
{
"identifier": "test",
"maximum": 128,
"minimum": 0,
"name": "test",
"special": {
"length": 2048,
"step": 0
},
"type": 1,
"unit": ""
}
],
"valueString": ""
}
cURL example:
curl --location --request POST '{{address}}/api/v1/affair/thing/draft/add?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 1' \
--header 'projectId: {projectId}' \
--data-raw '{
"class": 2,
"created": 0,
"description": "",
"id": 0,
"identifier": "test",
"kind": 0,
"modified": 0,
"name": "test",
"productId": 100075,
"required": true,
"type": 1,
"value": [
{
"identifier": "test",
"maximum": 128,
"minimum": 0,
"name": "test",
"special": {
"length": 2048,
"step": 0
},
"type": 1,
"unit": ""
}
],
"valueString": ""
}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 事件ID |
classification | int | 属性种类,1: 属性, 2: 事件 |
created | long | 创建时间 |
description | string | 描述 |
identifier | string | 属性名 |
kind | int | 属性分类,1: 标准, 2: 自定义 |
modified | long | 修改时间 |
name | string | 界面显示属性名 |
productId | int | 产品ID |
required | boolean | 属性是可选还是必选,true: 必选, false: 可选 |
type | int | 事件类型,信息:1,告警:2, 故障:3 |
valueString | string | 属性值的说明或限制 |
value | struct[] | 描述补充 |
value的子对象结构体:
Name | Type | Description |
---|---|---|
identifier | string | 属性名 |
maximum | long | 最大值 |
minimum | long | 最小值 |
name | string | 界面显示属性名 |
type | int | 数据类型,具体值参考公共能力type类型码表 |
unit | string | 单位 |
special | struct[] | 描述补充 |
special的子对象结构体:
Name | Type | Description |
---|---|---|
length | int | string类型的字符串长度,1~2048 |
step | double | 步长, 设备上传数据间隔, 整型/浮点型类型才有, 分别对应整型、浮点 |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) |
enumArray的子对象结构体:
Name | Type | Description |
---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) |
describe | string | 值对应的说明 |
Response example:
{
"code": 0,
"data": {
"identifier": "test",
"productId": 100075,
"created": 1607936838485,
"kind": 0,
"description": "",
"type": 1,
"required": true,
"valueString": null,
"name": "test",
"modified": 1607936838485,
"id": 4291,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test",
"unit": "",
"name": "test",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 2
},
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定事件,获取该事件草稿的详细信息。
GET /api/v1/affair/thing/draft/{id}
Path:
Name | Type | Description | Required |
---|---|---|---|
id | Integer | 事件ID | Yes |
cURL example:
curl --location --request GET '{{address}}/api/v1/affair/thing/draft/{id}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
id | int | 事件ID |
classification | int | 属性种类,1: 属性, 2: 事件 |
created | long | 创建时间 |
description | string | 描述 |
identifier | string | 属性名 |
kind | int | 属性分类,1: 标准, 2: 自定义 |
modified | long | 修改时间 |
name | string | 界面显示属性名 |
productId | int | 产品ID |
required | boolean | 属性是可选还是必选,true: 必选, false: 可选 |
type | int | 事件类型,信息:1,告警:2, 故障:3 |
valueString | string | 属性值的说明或限制 |
value | struct[] | 描述补充 |
value的子对象结构体:
Name | Type | Description |
---|---|---|
identifier | string | 属性名 |
maximum | long | 最大值 |
minimum | long | 最小值 |
name | string | 界面显示属性名 |
type | int | 数据类型, 1: string, 2: bool, 3: int32, 4: int64, 5: float32, 6: float64, 7: bytes, 8: date, 9: 枚举 |
unit | string | 单位 |
special | struct[] | 描述补充 |
special的子对象结构体:
Name | Type | Description |
---|---|---|
length | int | string类型的字符串长度,1~2048 |
step | double | 步长, 设备上传数据间隔, 整型/浮点型类型才有, 分别对应整型、浮点 |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) |
enumArray的子对象结构体:
Name | Type | Description |
---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) |
describe | string | 值对应的说明 |
Response example:
{
"code": 0,
"data": {
"identifier": "test",
"productId": 100075,
"created": 1607936838485,
"kind": 0,
"description": "",
"type": 1,
"required": true,
"valueString": "[{\"name\":\"xada1\",\"identifier\":\"xada1\",\"type\":1,\"minimum\":0,\"maximum\":128,\"unit\":\"\",\"special\":{\"length\":2048}}]",
"name": "test",
"modified": 1607936838485,
"id": 4291,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test",
"unit": "",
"name": "test",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 2
},
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定事件,删除该事件草稿。
DELETE /api/v1/affair/thing/draft/{id}
Path:
Name | Type | Description | Required |
---|---|---|---|
id | Integer | 事件ID | Yes |
cURL example:
curl --location --request DELETE '{{address}}/api/v1/affair/thing/draft/{id}?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response example:
{
"code": 0,
"data": {
"rowsAffected": 1
},
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定产品,获取该产品下事件草稿的详细信息。
GET /api/v1/affair/thing/draft/page
Query:
Name | Type | Description | Required |
---|---|---|---|
productId | int | 产品ID | Yes |
pageSize | int | 分页大小 | Yes |
currentPage | int | 页码 | Yes |
cURL example:
curl --location --request GET '{{address}}/api/v1/affair/thing/draft/page?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}&productId=100075&pageSize=600¤tPage=1'
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response data:
Name | Type | Description |
---|---|---|
totalCount | int | 总数量 |
pageSize | int | 分页大小 |
currentPage | int | 页码 |
totalPage | int | 总页数 |
content | struct[] | 内容 |
content的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 事件ID |
classification | int | 属性种类,1: 属性, 2: 事件 |
created | long | 创建时间 |
description | string | 描述 |
identifier | string | 属性名 |
kind | int | 属性分类,1: 标准, 2: 自定义 |
modified | long | 修改时间 |
name | string | 界面显示属性名 |
productId | int | 产品ID |
required | boolean | 属性是可选还是必选,true: 必选, false: 可选 |
type | int | 事件类型,信息:1,告警:2, 故障:3 |
valueString | string | 属性值的说明或限制 |
value | struct[] | 描述补充 |
value的子对象结构体:
Name | Type | Description |
---|---|---|
identifier | string | 属性名 |
maximum | long | 最大值 |
minimum | long | 最小值 |
name | string | 界面显示属性名 |
type | int | 数据类型, 1: string, 2: bool, 3: int32, 4: int64, 5: float32, 6: float64, 7: bytes, 8: date, 9: 枚举 |
unit | string | 单位 |
special | struct[] | 描述补充 |
special的子对象结构体:
Name | Type | Description |
---|---|---|
length | int | string类型的字符串长度,1~2048 |
step | double | 步长, 设备上传数据间隔, 整型/浮点型类型才有, 分别对应整型、浮点 |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) |
enumArray的子对象结构体:
Name | Type | Description |
---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) |
describe | string | 值对应的说明 |
Response example:
{
"code": 0,
"data": {
"totalPage": 1,
"pageSize": 600,
"currentPage": 1,
"totalCount": 3,
"content": [
{
"identifier": "test1",
"productId": 100075,
"created": 1607995745802,
"kind": 0,
"description": "",
"type": 1,
"required": true,
"valueString": null,
"name": "test1",
"modified": 1607995745802,
"id": 4295,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test1",
"unit": "",
"name": "test1",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 1
},
{
"identifier": "test2",
"productId": 100075,
"created": 1607936838485,
"kind": 0,
"description": "",
"type": 1,
"required": true,
"valueString": null,
"name": "test2",
"modified": 1607936838485,
"id": 4291,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test2",
"unit": "",
"name": "test2",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 1
},
{
"identifier": "test3",
"productId": 100075,
"created": 1607936757380,
"kind": 0,
"description": "",
"type": 1,
"required": true,
"valueString": null,
"name": "test3",
"modified": 1607936757380,
"id": 4288,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test3",
"unit": "",
"name": "test3",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 1
}
]
},
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定事件,删除该事件。
PUT /api/v1/affair/thing/draft/update
Body:
Name | Type | Description | Required |
---|---|---|---|
id | int | 事件ID | Yes |
name | string | 事件名称 | No |
value | struct[] | 对部分数据类型的补充说明 | No |
valueString | int | 属性值的说明或限制,入库用 | No |
description | String | 描述 | No |
value的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
name | string | 界面显示属性名 | Yes |
identifier | string | 属性名 | Yes |
type | int | 数据类型,具体值参考公共能力type类型码表 | Yes |
maximum | long | 最大值 | No |
minimum | long | 最小值 | No |
special | struct[] | 对部分数据类型的补充说明 | No(string/bytes/float32/float64/boolean/enum时必传) |
unit | string | 单位 | No |
special的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
length | int | string/bytes类型的字符串长度,1~2048 | No(string/bytes类型时必传) |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) | No(boolean或enum类型时必传) |
enumArray的子对象结构体:
Name | Type | Description | Required |
---|---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) | Yes |
describe | string | 值对应的说明 | Yes |
Body example:
{
"id": 10086,
"name": "test",
"created":0,
"description":"",
"identifier":"test2",
"kind":0,
"modified":0,
"productId":101119,
"required":false,
"type":2,
"value": [
{
"identifier": "test",
"maximum": 128,
"minimum": 0,
"name": "test",
"special": {
"length": 2048,
"step": 0
},
"type": 1,
"unit": ""
}
],
"valueString": "test"
}
cURL example:
curl --location --request DELETE '{{address}}/api/v1/affair/thing/draft/update?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--data-raw '{
"id": 10086,
"name": "test",
"created":0,
"description":"",
"identifier":"test2",
"kind":0,
"modified":0,
"productId":101119,
"required":false,
"type":2,
"value": [
{
"identifier": "test",
"maximum": 128,
"minimum": 0,
"name": "test",
"special": {
"length": 2048,
"step": 0
},
"type": 1,
"unit": ""
}
],
"valueString": "test"
}'
Response example:
{
"code": 0,
"data": {
"rowsAffected": 1
},
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定多个产品ID,获取所有产品下的事件。
GET /api/v1/affair/thing/batch
Body:
Name | Type | Description | Required |
---|---|---|---|
productIdList | int[] | 产品ID数组 | Yes |
Body example:
{
"productIdList": [10081, 10082]
}
cURL example:
curl --location --request GET '{{address}}/api/v1/affair/thing/batch?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 3' \
--header 'projectId: {projectId}' \
--data-raw '{
"productIdList": [114, 115]
}'
Response data:
Name | Type | Description |
---|---|---|
data | struct[] | 内容 |
data的子对象结构体:
Name | Type | Description |
---|---|---|
id | int | 事件ID |
classification | int | 属性种类,1: 属性, 2: 事件 |
created | long | 创建时间 |
description | string | 描述 |
identifier | string | 属性名 |
kind | int | 属性分类,1: 标准, 2: 自定义 |
modified | long | 修改时间 |
name | string | 界面显示属性名 |
productId | int | 产品ID |
required | boolean | 属性是可选还是必选,true: 必选, false: 可选 |
type | int | 事件类型,信息:1,告警:2, 故障:3 |
valueString | string | 属性值的说明或限制 |
value | struct[] | 描述补充 |
value的子对象结构体:
Name | Type | Description |
---|---|---|
identifier | string | 属性名 |
maximum | long | 最大值 |
minimum | long | 最小值 |
name | string | 界面显示属性名 |
type | int | 数据类型, 1: string, 2: bool, 3: int32, 4: int64, 5: float32, 6: float64, 7: bytes, 8: date, 9: 枚举 |
unit | string | 单位 |
special | struct[] | 描述补充 |
special的子对象结构体:
Name | Type | Description |
---|---|---|
length | int | string类型的字符串长度,1~2048 |
step | double | 步长, 设备上传数据间隔, 整型/浮点型类型才有, 分别对应整型、浮点 |
enumArray | struct[] | 枚举或布尔类型的相关信息的数组(布尔类型时元素的key有且仅有0/1,枚举类型时元素的个数不超过20个,key范围0~127) |
enumArray的子对象结构体:
Name | Type | Description |
---|---|---|
key | int | 枚举或布尔类型的值(布尔类型时key有且仅有0/1,枚举类型时key范围0~127) |
describe | string | 值对应的说明 |
Response example:
{
"code": 0,
"data": [
{
"identifier": "test1",
"productId": 100075,
"created": 1608081208243,
"kind": 2,
"description": "",
"type": 1,
"required": true,
"valueString": "[{\"name\":\"xada124\",\"identifier\":\"xada124\",\"type\":1,\"minimum\":0,\"maximum\":128,\"unit\":\"\",\"special\":{\"length\":2048}}]",
"name": "test1",
"modified": 1608081208243,
"id": 4299,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test1",
"unit": "",
"name": "test1",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 2
},
{
"identifier": "test2",
"productId": 100075,
"created": 1608081115724,
"kind": 2,
"description": "",
"type": 1,
"required": true,
"valueString": "[{\"name\":\"xada123\",\"identifier\":\"xada123\",\"type\":1,\"minimum\":0,\"maximum\":128,\"unit\":\"\",\"special\":{\"length\":2048}}]",
"name": "test2",
"modified": 1608081115724,
"id": 4298,
"value": [
{
"special": {
"length": 2048,
"step": null,
"enumArray": null
},
"identifier": "test2",
"unit": "",
"name": "test2",
"maximum": 128,
"type": 1,
"minimum": 0
}
],
"class": 2
}
],
"msg": "成功",
"referInfo": null,
"success": true
}
功能描述:指定产品,发布该产品下事件草稿。
POST /api/v1/affair/thing/publish/{productId}
Path:
Name | Type | Description | Required |
---|---|---|---|
productId | Integer | 产品ID | Yes |
cURL example:
curl --location --request POST '{{address}}/api/v1/affair/thing/publish/10086?accessKeyId={accessKeyId}&signatureNonce={signatureNonce}&signature={signature}'
--header 'platform: 3' \
--header 'projectId: {projectId}'
Response example:
{
"code": 0,
"data": {
"rowsAffected": 1
},
"msg": "成功",
"referInfo": null,
"success": true
}